home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 1 / Meeting Pearls Vol 1 (1994).iso / installed_progs / text / faqs / linux.howto.networking.part1 < prev    next >
Encoding:
Internet Message Format  |  1994-04-26  |  60.2 KB

  1. Subject: Linux NET-2 HOWTO (part 1/2)
  2. Newsgroups: comp.os.linux.announce,comp.os.linux.help,comp.os.linux.admin,news.answers,comp.answers
  3. From: terryd@extro.ucc.su.oz.au (Terry Dawson)
  4. Date: Mon, 25 Apr 1994 19:48:17 GMT
  5.  
  6. Archive-name: linux/howto/networking/part1
  7. Last-modified: 15 Apr 94
  8.  
  9.     This is the Linux NET-2 HOWTO (previously known as the NET-2-FAQ).     
  10.     This document explains how to configure TCP/IP and SLIP with the new 
  11.     ``NET-2'' networking code in Linux kernels 0.99.pl10 and above. 
  12.     Please mail me if you have questions or comments. --terryd
  13.  
  14. This is the Linux NET-2 HOWTO v1.11, 26 January 1994
  15. By Terry Dawson <terryd@extro.ucc.su.oz.au> and 
  16.    Matt Welsh <mdw@sunsite.unc.edu> 
  17.  
  18. (c)1994 by Terry Dawson, Matt Welsh
  19.  
  20. CHANGES from previous version:
  21.     Added the NFS questions and answers that Alan posted, thanks Alan.
  22.     Added dynamic slip server script - thanks Paul Mossip!
  23.     Added dip-i source, thanks Karl, kkeyte@esoc.bitnet
  24.     Added copyright message. Ack.
  25.  
  26. *** FTP site maintainers: This document should be stored in the docs/HOWTO
  27. *** directory on your Linux archive as ``NET-2-HOWTO''. You may also wish
  28. *** to link this file to ``NET-2-FAQ'' (its previous name). This document
  29. *** also supercedes the old Linux NET-FAQ.
  30.  
  31. 'Real Programmers don't write documentation.' -- Ancient Proverb
  32.  
  33. INDEX for this version
  34.  
  35.     To search for a particular section, search for '^N.S' where
  36.     N is the section, and S is the Subsection.
  37.  
  38.     0.    Introduction.
  39.     0.1    Disclaimer.
  40.     0.2    Questions already ?
  41.     0.3    Related documentation.
  42.     0.4    New versions of this document.
  43.     0.5    Feedback.
  44.     1.    NET-2 Supported Functionality.
  45.     1.1    Supported Ethernet cards.
  46.     2.    Getting the NET-2 Software.
  47.     2.1    Unpacking the software.
  48.     2.2    Putting things in the right place.
  49.     2.3    Creating the device interfaces.
  50.     3.    Building the Kernel.
  51.     3.1    Configuring the NET-2 kernel code.
  52.     3.2    Building the kernel.
  53.     4.    Configuring NET-2 TCP/IP.
  54.     4.1    Before you begin.
  55.     4.2    /etc/rc.d/rc.inet1 and /etc/rc.d/rc.inet2
  56.     4.2.1    Editing rc.inet1
  57.     4.2.2    Editing rc.inet2
  58.     4.2.2.1    "To named or not to named... that is the question."
  59.     4.3    /etc/hosts
  60.     4.3.1    Important note regarding /etc/hosts from NET-032.
  61.     4.4    /etc/networks
  62.     4.5    /etc/host.conf
  63.     4.6    /etc/resolv.conf
  64.     4.7    /etc/HOSTNAME
  65.     4.8    /etc/rc.local
  66.     4.9    Other files.
  67.     5.    Configuring SLIP.
  68.     5.1    Static SLIP server connections using a dialup line.
  69.     5.2    Static SLIP server connections using a leased line or cable.
  70.     5.3    Dynamic SLIP server connections using a dialup line.
  71.     5.4    Using DIP.
  72.     5.5    Configuring your Linux Machine as a SLIP Server.
  73.     5.6    /etc/net/diphosts
  74.     5.7    Configuring PLIP interfaces.
  75.     5.7.1    PLIP Cabling Diagram.
  76.     6.    PPP (Under construction).
  77.     7.    AX.25 (Under construction).
  78.     8.    Are You Stuck ?
  79.     9.    Common Problems and Solutions.
  80.     9.1    Not so common problems and solutions (Mostly NFS).
  81.     10.    Known bugs.
  82.     11.    Copyright Message. (We're not ogres, nor are we silly).
  83.     12.    Miscellaneous.
  84.     13.    Change History.
  85.  
  86. ------------------------------------------------------------------------------
  87. 0.    Introduction.
  88.  
  89.     This is the NET-2 HOWTO, which is a rewrite of the earlier NET-FAQ for
  90.     the new NET-2 TCP/IP code in Linux kernels 0.99.pl10 and above. 
  91.  
  92.     The NET-2 code is the new kernel-based networking support for Linux,
  93.     written by Fred van Kempen <waltje@uwalt.nl.mugnet.org>. It is based 
  94.     on the NET-1 code by Ross Biro <bir7@leland.stanford.edu>, ethernet 
  95.     drivers by Donald Becker <becker@super.org>, SLIP drivers by 
  96.     Laurence Culhane <loz@holmes.demon.co.uk>, and the D-Link driver by
  97.     Bj0rn Ekwall <bj0rn@blox.se>. The NET-2debugged code is maintained
  98.     by Alan Cox <iiitac@pyr.swan.ac.uk>. Many others too numerous to
  99.     mention have provided support, bug fixes, and help. 
  100.  
  101.     This NET-2 HOWTO is by Terry Dawson and Matt Welsh. It covers setup 
  102.     and configuration of TCP/IP under Linux using NET-2. It also hopefully 
  103.     answers some of the many questions about the NET-2 code and common
  104.     problems that people have. It does not cover using TCP/IP (i.e.
  105.     using telnet, FTP, etc.), other documents are available which will
  106.     describe these much better than I am able to.
  107.  
  108. 0.1    Disclaimer.
  109.  
  110.     The NET-2 code is under development, which means that it may 
  111.     not be as stable and easy to configure as you may like it to be.
  112.     code is relatively new and bug fixes are being posted every day, so if 
  113.     you run into a large number of problems just hang in there. The 
  114.     software is in two stages of development at the moment. The version
  115.     currently supplied in the standard kernel distribution is version
  116.     NET-2D(ebugged), and is being progressively debugged and made more
  117.     stable by Alan Cox, until NET-2E, which is currently undergoing Beta
  118.     testing, is ready for general release.
  119.  
  120.     We do not, and cannot know everything there is to know about the
  121.     Linux networking code. Please accept that this document may, and
  122.     probably does contain errors. Please read any README files that
  123.     are bundled with any of the various pieces of software described
  124.     in this document for more detailed and accurate information. We
  125.     will attempt to keep this document as error free as possible.
  126.  
  127.     NOTE: In this document, 'NET-2' does not refer to the Berkeley
  128.     Software Distribution NET-2 release of BSD UNIX. Yes, the names
  129.     are conflicting. In this HOWTO, 'NET-2' refers only to the new
  130.     generation of TCP/IP code in the Linux kernel.
  131.  
  132. 0.2    Questions already ?
  133.  
  134.     'The only stupid question is the unasked one.' - One of my own Motto's
  135.  
  136.     If you have general configuration questions, and you have been unable
  137.     to find the answers after reading the other various HOWTO and FAQ
  138.     files,    then you would be best served to post them comp.os.linux.help,
  139.     or, if you believe it to be specifically related the NET-2 kernel
  140.     code, then you could post it to the NET mailing list. Please include
  141.     as much relevant information as possible, there is nothing more
  142.     annoying than to have a bug or problem reported without sufficient
  143.     information to even begin searching for it.
  144.  
  145.     Version numbers and revisons of code, a detailed account of the
  146.     problem, and the circumstances that caused it to happen are essential.
  147.     Traces and debug messages where available should also be considered
  148.     mandatory.
  149.  
  150.     If you have a question relating to the configuration of, or problems
  151.     experienced with, _any_ linux distribution, regardless of
  152.     whether it be SLS, Slackware, Yggadsril, TAMU, MCC, Pro, or other,
  153.     please contact the people who created the distribution for support
  154.     before attempting to report it to the list or the NET-2 developers
  155.     directly. The developers of the NET-2 code _cannot_ and _will not_
  156.     offer support for NET-2 as distributed in any form, other than as
  157.     specified in this document, or as per distributed Alpha/Beta test
  158.     instructions.
  159.  
  160.     Please do NOT bug the NET-2 developers directly unless you have a
  161.     _development_-related issue (especially Fred: he has to pay $$$ for
  162.     his e-mail access).
  163.  
  164.         To join the NET channel of the Linux-activists mailing list
  165.         send mail to
  166.                 linux-activists-request@niksula.hut.fi
  167.         with the line
  168.                 X-Mn-Admin: join NET
  169.         at the top of the message body (not the subject).
  170.  
  171.     Note that the SLIP channel of the mailing list has been disabled and
  172.     the NET channel should be used for SLIP discussions as well.
  173.     Remember, keep in mind that the NET channel is for development
  174.     discussions only.
  175.  
  176.     Note also that a PPP list has been established. To join it, use the
  177.     same procedure as for joining the NET list, except specify PPP in
  178.     place of NET.
  179.  
  180.  
  181. 0.3    Related documentation.
  182.  
  183.     There is now a book from the Linux Documentation Project entitled
  184.     `Linux Network Administration Guide' by Olaf Kirch. It covers all
  185.     aspects of setting up and using networking under Linux, including
  186.     TCP/IP, NFS, UUCP, mail, news, etc.
  187.  
  188.     This book supplements the NET-2 HOWTO  and covers all of the
  189.     other aspects of using TCP/IP. This guide simply covers setup of 
  190.     NET-2, i.e., "How to put your machine on the net". If you are new
  191.     to unix networking, then I strongly urge you to obtain a copy and
  192.     read it first. It will answer a lot of questions for you that are
  193.     not within the scope of this document.
  194.  
  195.     The current version is available in:
  196.  
  197.     sunsite.unc.edu:/pub/Linux/docs/linux-doc-project/network-guide
  198.  
  199.     There are various versions of the file available. The most common
  200.     formats are supported, being plain ascii, Postscript, DVI, Latex
  201.     and groff.
  202.  
  203.     The Linux Network Administrators Guide is Copyright (c) by Olaf Kirch.
  204.  
  205.     You should read the Ethernet HOWTO (from sunsite.unc.edu:
  206.     /pub/Linux/docs/HOWTO) if you are using an Ethernet network
  207.     with NET-2. The Ethernet HOWTO explains all of the ins and outs
  208.     of using and configuring Ethernet devices for Linux, and should
  209.     be considered the definitive source of information relating to same.
  210.     That is, if the Ethernet HOWTO and this HOWTO differ, then believe
  211.     the Ethernet HOWTO.
  212.  
  213.     This NET-2 HOWTO supercedes the earlier 'Linux NET-FAQ' by Phil
  214.     Copeland and Matt Welsh. The NET-FAQ is for Linux kernels previous
  215.     to 0.99.pl10, running the older version of the TCP/IP code.
  216.  
  217.     This document used to be called the NET-2-FAQ, before the Linux HOWTO
  218.     project was underway. Thus, the NET-2-FAQ and the NET-2 HOWTO are
  219.     the same.
  220.  
  221. 0.4    New versions of this document.
  222.  
  223.     New versions of this document can be retrieved via anonymous
  224.     FTP from sunsite.unc.edu:/pub/Linux/docs/HOWTO/NET-2-HOWTO
  225.     or directly from me (terryd@extro.ucc.su.oz.au). It will also be
  226.     posted to the newsgroups comp.os.linux.announce, comp.os.linux.help,
  227.     and news.answers periodically. 
  228.  
  229.     You can find news.answers FAQ postings, including this one, archived
  230.     on rtfm.mit.edu:/pub/usenet.
  231.  
  232. 0.5    Feedback.
  233.  
  234.     Please send any comments, updates, or suggestions to me,
  235.     terryd@extro.ucc.su.oz.au. The sooner I get feedback about this
  236.     document, the sooner I can update and correct it. If you find any
  237.     problems with it, please mail me, instead of posting to one of the
  238.     newsgroups. I may miss your corrections. Thanks.
  239.  
  240.     Please send any money or interesting pieces of hardware to either
  241.     Fred, Linus, or the Free Software Foundation. They made this happen.
  242.  
  243.  
  244. 1.    NET-2 Supported Functionality.
  245.  
  246.     The NET-2 code is a complete kernel implementation of TCP/IP for
  247.     Linux, including many features not found in the original networking
  248.     code. NET-2 supports most popular Ethernet cards, real IP routing,
  249.     SLIP (Serial Line IP) for TCP/IP connections over a serial line, such
  250.     as the phone line via modem, and PLIP (Parallel Line IP) for local
  251.     connection of two machines using your printer ports. 
  252.  
  253.     NET-2 does not yet include:
  254.  
  255.      - SPX(SPP)/IPX(IDP)/NCP support, though it is being worked on.
  256.     - PPP support, this is being worked on, and an ALPHA version exists.
  257.       read on for more details.
  258.     - AX.25 support natively, though Alan Cox has some experimental code
  259.       available for pl14+ for you to try. Fred has the start of fully
  260.       integrated DDI based AX25 support in NET-2EB2+
  261.     - LAN types other than Ethernet, this means no Token Ring, no
  262.       FDDI, no ARCNET, etc. An experimental Token Ring driver is being
  263.       quietly developed.
  264.     - ISDN support, though I understand it too is being worked on.
  265.  
  266. 1.1    Supported Ethernet cards.
  267.  
  268.     NET-2 supports the following Ethernet cards (and more):
  269.  
  270.     3com 3c503, 3c503/16
  271.     Novell NE1000, NE2000
  272.     Western Digital WD8003, WD8013
  273.     Hewlett Packard HP27245, HP27247, HP27250
  274.  
  275.     The following clones are reported to work:
  276.     WD-80x3 clones: LANNET LEC-45
  277.     NE2000 clones: Alta Combo, Artisoft LANtastic AE-2, Asante Etherpak
  278.       2001/2003, D-Link Ethernet II, LTC E-NET/16 P/N 8300-200-002,
  279.       Network Solutions HE-203, SVEC 4 Dimension Ethernet, 4-Dimension
  280.       FD0490 EtherBoard 16, D-Link DE-600, SMC Elite 16.
  281.  
  282.     ** Please see the Ethernet HOWTO for more complete information. **
  283.  
  284.     As mentioned above, NET-2 also supports SLIP in the kernel. Therefore
  285.     if you don't have an Ethernet connection you can do TCP/IP over the
  286.     phone line, provided you have a SLIP server nearby (many universities
  287.     and businesses provide SLIP access to employees/students) and a
  288.     compatible modem (usually 14.4 v.42bis, depending on your SLIP server).
  289.     Two possible modems are the US Robotics Sportster, or the Infotel
  290.     144DF Internal. 
  291.  
  292.  
  293. 2.    Getting the NET-2 Software.
  294.  
  295.     Before you can configure TCP/IP on your system you need to get the
  296.     appropriate software. This includes the current version of the Linux
  297.     kernel (0.99.pl14 or above), TCP/IP configuration programs and files
  298.     (e.g., /etc/ifconfig, /etc/hosts), and finally a set of network
  299.     application programs (such as telnet, ftp, rlogin, etc.). 
  300.  
  301.     You may already have all of the items below. Check and make
  302.     sure that you do. For example, some distributions come with all
  303.     of the NET-2 configuration files, binaries, libraries, and kernel
  304.     installed, so there's no reason to get the following files.
  305.     Note: they may not be in the places specified in this HOWTO.
  306.  
  307.     If you DO have the NET-2 software already, skip to section 3 on
  308.     configuration. If you do NOT have the NET-2 software, follow the
  309.     directions below.
  310.  
  311.     The current kernel version is found in
  312.     nic.funet.fi:/pub/OS/Linux/PEOPLE/Linus/linux-0.99.14.tar.gz. 
  313.     This is a gzipped tar file; .gz is the new extension used by gzip.
  314.     If you have the old version of gzip, "zcat foo.gz | tar xvf -" works.
  315.  
  316.     The current libraries (libc-4.4.4), can be found in 
  317.     sunsite.unc.edu:/pub/Linux/GCC/image-4.4.4.tar.z. (You'll probably 
  318.     want to install the include files in inc-4.4.4.tar.z as well! See the 
  319.     READMEs there for details.) You'll need at least ver 4.4.2 to use
  320.     NET-2, as there were problems with earlier versions that affected
  321.     routing and netmasks.
  322.  
  323.     The current NET-2 configuration file distribution is in
  324.  
  325.     sunacm.swan.ac.uk:
  326.     /pub/misc/Linux/Networking/Programs/System/net032/net-0.32.tar.gz
  327.  
  328.     This package includes network configuration programs such as
  329.     ifconfig, route, netstat etc.
  330.  
  331.     The TCP/IP application binaries and setup files are found in:
  332.  
  333.     tsx-11.mit.edu:/pub/linux/packages/net/net-2/binaries/net-base.tar.z
  334.           "          "    "      "      "    "      "    /net-std.tar.z
  335.           "          "    "      "      "    "      "    /net-ext.tar.z
  336.  
  337.     As some of the internals of the networking code have changed, you will
  338.     also need to get and install the files that are in the:
  339.  
  340.     tsx-11.mit.edu:/pub/linux/packages/net/new-net-2
  341.  
  342.     directory, as they correct some problems you will experience if you
  343.     opt _not_ to get and install them :)
  344.  
  345.     If you use shadowed password (Most SLS users do), then you may find
  346.     that the standard network programs do not support them. There used
  347.     to be a specially modified package of binaries about, but these were
  348.     intended as a short term fix, and have been removed. Recent work on
  349.     the standard libraries will mean that as of version 4.5.8 of libc,
  350.     the shadow password handling will no longer need to be in the
  351.     application, and will be handled externally. At the time of writing
  352.     libc.4.5.8 has just been released. If you use shadowed passwords
  353.     you will most certainly want a copy of this.
  354.  
  355. 2.1    Unpacking the software.
  356.  
  357.     You don't need to unpack any of the following if you already have all
  358.     of the NET-2 software installed.
  359.     
  360.     First, unpack the kernel sources in /usr/src. This will put all
  361.     of the kernel sources under /usr/src/linux (the usual place).
  362.  
  363.         # cd /usr/src
  364.         # zcat linux-0.99.14.tar.z | tar xvf -
  365.  
  366.     Next, unpack the libraries. 
  367.     (The following is a summary, please read the detailed instructions
  368.     that come with the libraries for complete installation details)
  369.  
  370.         # cd /
  371.         # zcat image-4.4.4.tar.z | tar xvf -
  372.  
  373.     Now, make the links to the new libraries in /lib. BE VERY CAREFUL
  374.     that you do not delete the previous links. Do everything in
  375.     one step, as so:
  376.  
  377.         # ln -sf /lib/libc.so.4.4.4 /lib/libc.so.4
  378.         # ln -sf /lib/libm.so.4.4.4 /lib/libm.so.4
  379.  
  380.     Next, unpack the net-base package, which contains the basic
  381.     utils and configuration files in /etc. Note that net-base makes
  382.     symlinks in /etc for all of your TCP/IP configuration files to /conf.
  383.  
  384.     Therefore, BE WARNED: Before you unpack the following tar files,
  385.     make a backup of your files in /etc. Unpacking net-base will overwrite
  386.     many of the files in /etc with symbolic links to other places.
  387.     For example, /etc/hosts is a symlink to /conf/net/hosts. Why is this
  388.     done? Because Fred's Linux/PRO distribution of Linux keeps all
  389.     machine-specific configuration files in /conf. And because this is
  390.     the way he does it, we may as well too. In general it makes things
  391.     easier to locate. If you want to keep all of your net files in 
  392.     /etc, that's fine, but you'll have to put them there by hand.
  393.  
  394.     Make a backup of everything in /etc before you unpack net-base. 
  395.     Then unpack it from / (the root directory):
  396.  
  397.         # cd /
  398.         # zcat net-base.tar.z | tar xvvofp -
  399.  
  400.     Also, unpack net-std.tar.z, which contains the network clients and
  401.     daemons (e.g., telnet and telnetd). Unpack it from / as well:
  402.  
  403.         # cd /
  404.         # zcat net-std.tar.z | tar xvvofp -
  405.  
  406.  
  407.     If you wish to use tin (a newsreader), or DIG (the DARPA Internet
  408.     Groper), unpack the net-ext package from /:
  409.  
  410.         # cd /
  411.         # zcat net-ext.tar.z | tar xvvofp -
  412.  
  413.     Now unpack the fixed versions of rlogin/telnetd from the files:
  414.  
  415.         # cd /tmp
  416.         # gzip -dc ftpd.tar.z | tar xvf -
  417.         # gzip -dc telnet-rlogin.tar.z | tar xvf -
  418.  
  419.         you will then need to copy the binaries to where the old
  420.         version currently live.
  421.         
  422.     Finally, unpack the net-032 package, which contains the sources
  423.     for the TCP/IP setup programs (ifconfig, arp, route, etc.) and the
  424.     configuration files. This is unpacked into /usr/src/net-032.
  425.  
  426.         # mkdir /usr/src/net-032
  427.         # cd /usr/src/net-032
  428.         # zcat net-032.tar.gz | tar xvvofp -
  429.         # make install
  430.  
  431.     ** Important information for Shadow Password users **
  432.     If you are using the SLS distribution, then replace any blank
  433.     passwords in /etc/passwd with :x: instead of ::.
  434.     Otherwise rshd/rlogind will let anyone become these user ids.
  435.         This is an SLS setup bug and will, by default allow anyone remote
  436.     access to your machine, with root priveledges!
  437.  
  438. 2.2    Putting things in the right place.
  439.  
  440.     With the standard NET-2 distribution, all of the configuration files
  441.     are in /conf/net, with links in /etc. For example, /etc/hosts
  442.     is a link to /conf/net/hosts. However, if you are using a 
  443.     standard pre-packaged distribution of Linux such as SLS, /conf/net
  444.     probably isn't used... that is, /etc/hosts is just /etc/hosts.
  445.     So, when I say "/conf/net/hosts", I mean "/etc/hosts", and vice
  446.     versa.
  447.  
  448.     Just keep in mind that the TCP/IP software only looks in /etc and
  449.     /usr/etc for configuration files. Therefore, it makes sense to
  450.     keep all of your files in /etc and /usr/etc as they should be.
  451.     HOWEVER, Fred has decided to put the files in /conf/net with LINKS
  452.     in /etc. Either way, it doesn't matter. When we say "/etc/hosts",
  453.     it doesn't matter if /etc/hosts is an actual file or a link to
  454.     /conf/net/hosts.
  455.  
  456.     If you just unpacked NET-2 above (i.e. you don't already have the
  457.     files from installing SLS), then you don't have the configuration
  458.     files in /conf/net (you only have the symlinks in /etc). 
  459.     The easiest way to get the configuration files in /conf/net is
  460.     to copy them from the net-032 distribution:
  461.  
  462.         # mkdir -p /conf/net
  463.         # chown -R root.root /conf; chmod -R 755 /conf
  464.         # cp /usr/src/net-032/etc/* /conf/net
  465.  
  466.     You should make sure that all of the symlinks to /conf/net in /etc
  467.     can be resolved (that is, try to "more" or "cat" each file, make
  468.     sure you don't get any errors). Also note that some files will
  469.     be duplicated: for example, /etc/inetd.conf is a symlink to 
  470.     /usr/etc/inetd.conf. However, from the cp command above you also
  471.     have a /conf/net/inetd.conf, which can be deleted (remember that
  472.     all of the programs still look in /etc, not /conf. So whatever is
  473.     in /etc is the file which is actually being used).
  474.  
  475.  
  476. 2.3    Creating the device interfaces.
  477.  
  478.     In previous versions it was necessary to create a number of
  479.     device files for the NET-2 code. This is no longer the case.
  480.  
  481.     If you have any of the following files created you should delete
  482.     them:
  483.  
  484.     rm /dev/net /dev/unix /dev/inet
  485.     rm /dev/ip /dev/icmp /dev/tcp /dev/udp
  486.     rm /dev/wd0 /dev/wd1 /dev/wd2 /dev/wd3
  487.     rm /dev/ec0 /dev/ec1 /dev/ec2 /dev/ec3
  488.     rm /dev/ne0 /dev/ne1 /dev/ne2 /dev/ne3
  489.  
  490.     should clean them all.
  491.  
  492.     However, the arp program does need /dev/arp, so:
  493.  
  494.     mknod -m 600 /dev/arp c 16 1
  495.  
  496.     will create it ok. If you already have it, check that it looks
  497.     the same.
  498.  
  499. 3.    Building the Kernel.
  500.     
  501.     You're now ready to build the new 0.99.pl14 kernel with the NET-2
  502.     code enabled. 
  503.  
  504. 3.1    Configuring the NET-2 kernel code.
  505.  
  506.         A 'make config' will take you through configuring the kernel
  507.         Select the drivers you desire by answering 'yes' when prompted.
  508.  
  509.     Note, you will be prompted for "Network Device Support?", but
  510.     the label after it might suggest that this is for Ethernet only,
  511.     this is not the case, and you must answer 'yes' to this, even if
  512.     you only desire the slip or plip drivers to be configured.
  513.     You will be asked later about each of the ethernet drivers,
  514.     slip and plip in turn.
  515.  
  516.     The Ethernet HOWTO also contains much useful information for
  517.     configuring Ethernet devices in the kernel.
  518.  
  519. 3.2    Building the kernel.
  520.  
  521.     You can now build the kernel as you normally would (see the file
  522.     /usr/src/linux/README if you've never done this before). Essentially
  523.     this entails editing /usr/src/linux/Makefile to set root device and
  524.     default display mode. (*Note: keyboard is now handled by loadable
  525.     keymaps as of 0.99.pl10; grab the file keytable.tar.z from your 
  526.     nearest Linux ftp site). 
  527.  
  528.         Finally do 'make dep' and 'make'. You now have a new 0.99.14 kernel
  529.         with NET-2 set up. I wouldn't reboot it quite yet as we still have
  530.         to configure the NET-2 programs before it will work correctly.
  531.  
  532. 4.    Configuring NET-2 TCP/IP.
  533.  
  534.     The final step is to modify the various setup files to get NET-2
  535.     working. After this is ready you can boot your new kernel and 
  536.     go happily netting (if all goes well).
  537.  
  538.     In this section I'll describe each of the major TCP/IP setup files,
  539.     what they do, and what you need to do to configure them. 
  540.  
  541.     If you're using SLIP, see section 5.0 on configuring SLIP. The
  542.     discussion below is for Ethernet connections only. SLIP users
  543.     should FIRST read all of section 4.0 and then apply the changes
  544.     discussed in section 5.0.
  545.  
  546. 4.1    Before you begin.
  547.  
  548.     Before you can configure NET-2 TCP/IP, you need to find out
  549.     the following information about your network setup. Your network
  550.     admins can tell you most of these things.
  551.     
  552.     * IP address: this is the unique machine address in dotted-decimal
  553.       format. An example is 128.253.153.54. Your network admins will 
  554.       provide you with this number. 
  555.       
  556.       If you're only configuring loopback mode (i.e. no SLIP, no ethernet 
  557.       card, just TCP/IP connections to your own machine---called 
  558.       "loopback") then your IP address is 127.0.0.1.
  559.  
  560.     * Your network mask ('netmask'). For performance reasons, it is
  561.       desirable to limit the number of hosts on any particular segment
  562.       of a network. If you have a large number of addresses allocated
  563.       to you, you might break those addresses up into large chunks,
  564.       and create subnetworks, and then allow each individual network
  565.       segment be a subnetwork of the whole network. The network mask
  566.       is a pattern of bits, which when overlayed onto an address on your
  567.       network, will tell you which subnet that address lives on. This is
  568.       very important for routing, and if you find, for example, that you
  569.       can happily talk to people outside your network, but not to some
  570.       people within your network, there is a good chance that you have
  571.       an incorrect mask specified.
  572.  
  573.       Your network administrators will have chosen the netmask when the
  574.       network was designed, and therefore they should be able to supply
  575.       you with the correct mask to use. Most networks are class C
  576.       subnetworks which use 255.255.255.0 as their netmask. Other Class B
  577.       networks use 255.255.0.0. The NET-2 code will automatically select
  578.       a mask that assumes no subnetting as a default if you do not specify
  579.       a mask.
  580.  
  581.       The masks chosen by default are as follows:
  582.  
  583.       For addresses with the first byte:
  584.       1-127        255.0.0.0        (Class A)
  585.       128-191    255.255.0.0        (Class B)
  586.       192+        255.255.255.0        (Class C+)
  587.  
  588.       If one of these doesn't work, try the other. If this
  589.       doesn't work, ask your local net guru for help.
  590.  
  591.       This applies equally well to the loopback port. Since the
  592.       loopback ports address is always 127.0.0.1, the netmask for
  593.       this port is always 255.0.0.0. You can either specify this
  594.       explicitly or rely on the default mask.
  595.  
  596.     * Your network address. This is your IP address masked with the netmask.
  597.       For example, if your netmask is 255.255.255.0, and your IP address
  598.       is 128.253.154.32, your network number (IP addr AND netmask) is 
  599.       128.253.154.0. With a netmask of 255.255.0.0, 
  600.       this would be 128.253.0.0. 
  601.  
  602.       If you're only using loopback, you don't have a net address.
  603.  
  604.     * Your broadcast address. This is your IP address masked with the
  605.       netmask, and then possibly ORed with the subnetmask inverted.
  606.       Such that for a Class C network, with netmask 255.255.255.0,
  607.       your broadcast address will be your network address (calculated
  608.       above) ORed with 0.0.0.255.
  609.  
  610.       For example:
  611.  
  612.       Your IP address is:            128.253.154.32
  613.       Your netmask is:            255.255.255.0
  614.       netmask inverted is:            000.000.000.255
  615.  
  616.       then:
  617.  
  618.       Your broadcast address should be:    128.253.154.255.
  619.  
  620.       Note that for historical reasons, some networks are setup to use
  621.       the network address as the broadcast address, if you have any doubt,
  622.       check with your net admin.
  623.  
  624.       If you have access to a sniffer, or some other device capable of
  625.       providing a trace of your network, then you might be able to
  626.       determine both the network and broadcast addresses by looking at the
  627.       traffic on your network. Keep an eye open (or filter all traffic
  628.       except) for ethernet frames destined for the ethernet broadcast
  629.       address: ff:ff:ff:ff:ff:ff, if it is an IP datagram, then look at
  630.       the destination ip address. If the IP source address is your router,
  631.       and the protocol ID is not ARP, then what you are seeing might be a
  632.       routing broadcast. The destination IP address in this case will be
  633.       the IP broadcast address of your network. You can then work out the
  634.       IP network address. But again, if in doubt then consult your network
  635.       admin, or check the configuration of a known working machine.
  636.  
  637.       If you're only using loopback, you don't have a broadcast address.
  638.  
  639.     * Your gateway address. This is the address of the machine which
  640.       is your "gateway" to the outside world (i.e. machines not on your
  641.       subnet). In general the gateway machine has an IP address identical
  642.       to yours but with a ".1" in the last position; e.g. if your IP
  643.       address is 128.253.154.32, your gateway might be 128.253.154.1.
  644.       Your network admins will provide you with the IP address of your
  645.       gateway.
  646.  
  647.       If you're only using loopback, you don't have a gateway address.
  648.       If your network is not connected to the Internet, that is, it
  649.       is a standalone network, then you don't have a gateway, and
  650.       therefore don't need a gateway address.
  651.     
  652.     * Your nameserver address. Most machines on the net have a name
  653.       server which translates hostnames into IP addresses for them. 
  654.       Your network admins will tell you the address of your name server.
  655.       You can in fact run a nameserver on your own machine by running
  656.       named, in which case the nameserver address is 127.0.0.1. However,
  657.       But it is not required that you run named at all; see section
  658.       4.2.2.1.
  659.  
  660.       If you're only using loopback, you don't have a nameserver
  661.       address. (After all, you're only connecting to yourself.)
  662.  
  663.     SLIP USERS: You may or may not require any of the above information
  664.     except for a nameserver address. Depending on how your slip access
  665.     is achieved, you will either be given an ip address to use, in
  666.     which case you probably already know it, or the slip server will
  667.     dynamically allocate one for you. How to handle this situation is
  668.     described in section 5.
  669.  
  670.     NET-2 supports full routing, multiple routes, subnetworking (at
  671.     this stage on byte boundaries only), the whole nine yards. The above
  672.     describes most basic TCP/IP configurations. Yours may be quite
  673.     different: when in doubt, consult your local network gurus and check
  674.     out the man pages for "route" and "ifconfig" included with the net-032
  675.     package. Configuring TCP/IP networks is very much beyond the scope of
  676.     this document; the above should be enough to get most people started.
  677.  
  678. 4.2    /etc/rc.d/rc.inet1 and /etc/rc.d/rc.inet2
  679.  
  680.     For the non-UNIX wizard: "rc" files are run at bootup time by the
  681.     "init" program and start up all of the basic system programs, such
  682.     as sendmail, cron, etc. as well as the NET-2 daemons (such as inetd).
  683.     They are analogous to the MS-DOS autoexec.bat file, and "rc" might
  684.     stand for "runtime commands". For NET-2 the rc files are found in
  685.     /etc/rc.d. It doesn't really matter where you keep them, as long as
  686.     init can find them. (We'll go into this later). 
  687.  
  688.     First things first. The file /etc/rc.d/rc.inet1 configures the basic
  689.     TCP/IP interface to your machine, using two programs: /etc/ifconfig
  690.     and /etc/route.
  691.  
  692.     /etc/ifconfig is used for configuring interface with the parameters
  693.     that they require to function, such as IP addresses, network masks,
  694.     broadcast addresses and the like.
  695.  
  696.     /etc/route is used to create entries in a table (the routing table)
  697.     that the networking code will look in, to determine where to send
  698.     datagrams that it wishes to transmit.
  699.  
  700.     Note that in the previous NET-1 code, the name of the interface
  701.     configuration program was "config". However, the "standard" for UNIX
  702.     system TCP/IP configuration is to use ifconfig and route, and this has
  703.     been implemented with NET-2.
  704.     
  705.     THEREFORE: Be sure NOT to use /etc/config in your rc files. "config"
  706.     will not work with NET-2, and if you try and use it you will see
  707.     messages mentioning "old-style ioctl", and it wont work. You should
  708.     only run rc.inet1 and rc.inet2 at boot time (or rc.net after you have
  709.     converted it).
  710.  
  711.     NOTE: The standard SLS "rc" file file calls "/etc/rc.net" instead
  712.     of "/etc/rc.d/rc.inet1" and "/etc/rc.d/rc.inet2". The SLS rc.net
  713.     file can be treated as just the rc.inet1 and rc.inet2 files in
  714.     one file. So when you see rc.inet1, and rc.inet2 below, just add the
  715.     same commands into /etc/rc.net, and you will achieve the same result.
  716.     It is important that the commands in rc.inet1 be run first, so make
  717.     sure those commands are at the top of the file.
  718.  
  719.     Below you're going to edit rc.inet1 to use the correct ifconfig and
  720.     route commands for your machine. But first, you need to know the
  721.     information about your network setup in section 4.1, above.
  722.  
  723. 4.2.1    Editing rc.inet1
  724.  
  725.     Edit the file /etc/rc.d/rc.inet1. This file uses the "ifconfig" and
  726.     "route" commands to configure your network interface at boot time.
  727.     SLS Users: Remember that SLS uses just rc.net, and these command
  728.     should be called first, so put them at the top of the file.
  729.  
  730.     You may need to do some heavy surgery on this file to get it to look
  731.     right; it may be easier to delete it and start from scratch. Given
  732.     the information above, a possible rc.inet1 for a machine that has
  733.     a single ethernet interface should look like:
  734.  
  735.  
  736. #!/bin/sh
  737. # Portion of /etc/rc.d/rc.inet1 to configure the loopback interface
  738.  
  739. HOSTNAME=`hostname`
  740.  
  741. # Attach the loopback device. 
  742. /etc/ifconfig lo 127.0.0.1    # uses default netmask 255.0.0.0
  743. /etc/route add 127.0.0.1    # a route to point to the loopback device
  744. # End Loopback Definition
  745.  
  746. # Portion of /etc/rc.d/rc.inet1 to configure an ethernet interface
  747.  
  748. # IF YOU HAVE AN ETHERNET CONNECTION, use these lines below to configure the 
  749. # eth0 interface. If you're only using loopback or SLIP, don't include the
  750. # rest of the lines in this file.
  751.  
  752. # Edit for your setup.
  753. IPADDR="128.253.154.32"        # REPLACE with YOUR IP address!
  754. NETMASK="255.255.255.0"        # REPLACE with YOUR netmask!
  755. NETWORK="128.253.154.0"        # REPLACE with YOUR network address!
  756.                 # Note: NETWORK MUST be in
  757.                 #       /etc/networks
  758. BROADCAST="128.253.154.255"    # REPLACE with YOUR broadcast address, if you
  759.                 # have one. If not, leave blank and edit below.
  760. GATEWAY="128.253.154.1"        # REPLACE with YOUR gateway address!
  761.  
  762. /etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK} broadcast ${BROADCAST}
  763. # If you don't have a broadcast address, change the above line to just:
  764. # /etc/ifconfig eth0 ${IPADDR} netmask ${NETMASK} 
  765.  
  766. /etc/route add ${NETWORK}            # MUST HAVE AN ENTRY IN
  767.                         # /etc/networks !!!
  768.  
  769. /etc/route add default gw ${GATEWAY} metric 1    # Only necessary if your
  770.                         # network has an Internet
  771.                         # connection.
  772. # End of Ethernet Configuration
  773.  
  774.  
  775.     This is a basic rc.inet1 to run the ifconfig and route commands
  776.     needed to set up a basic TCP/IP connection. Edit this for your setup.
  777.     If you do not have an ethernet interface, and either have a standalone
  778.     workstation (no network connection at all), or you use SLIP, then
  779.     you need only the two lines that refer to the loopback interface "lo"
  780.     as noted.
  781.  
  782.     To ensure that this will be run at boot time, make sure that you
  783.     include the command:
  784.  
  785.         /bin/sh /etc/rc.d/rc.inet1
  786.  
  787.     in your /etc/rc, or in your /etc/inittab (if you're running the
  788.     sysvinit package). In general, make sure that rc.inet1 is run
  789.     BEFORE rc.inet2 at boot time. You may wish to run rc.inet1 and
  790.     rc.inet2 from /etc/rc or /etc/rc.local. Or you can run them from
  791.     /etc/inittab. Either way is fine, but don't run one without the other.
  792.  
  793.  
  794. 4.2.2    Editing rc.inet2
  795.  
  796.     Having run rc.inet1, you now your interfaces configured with addresses,
  797.     and a routing table with enough information to get you started. You'll
  798.     now want to do something with them.
  799.  
  800.     The rc.inet2 script is also run at boot time, AFTER rc.inet1.
  801.     It starts up various TCP/IP daemons such as inetd, portmapper, 
  802.     and so on. Remember that SLS uses just rc.net, thus, the following
  803.     should appear at the bottom of the file.
  804.  
  805.     Now would be a really good time for you to read Olafs Network
  806.     Administrators Guide. It will help you decide what you need to
  807.     put in this file, and what you don't need to put in this file.
  808.  
  809.     But Briefly:
  810.     'inetd' is a program that sits in the background and manages
  811.     internet connection requests and the like. It is smart enough
  812.     that you don't need to leave a while bunch of servers running
  813.     even when there is nothing connected to them. When it sees an
  814.     incoming request for a particular service, eg telnet or ftp, it
  815.     will check the /etc/services file, and find what server program
  816.     needs to be run to manage the request, will start it, and hand
  817.     the connection over to it. Imagine it as a master server for you
  818.     internet servers.
  819.  
  820.     'syslogd' is a daemon (server that runs in the background) that
  821.     handles all system logging. It accepts messages generated for it,
  822.     will distribute them according to the specifications in
  823.     /etc/syslogd.conf. For example, certain types of messages you will
  824.     want to send to the console and also to log to a file, while others
  825.     will need only be logged, while others yet again, will only need
  826.     to go to the console. syslogd allows you to specify what messages
  827.     you want to send where.
  828.  
  829.     For a more complete and detailed description of how all the networking
  830.     bits and pieces fit together, please get Olaf Networking Guide as
  831.     described in section 0.3 (Related Documentation).
  832.  
  833.  
  834.     You will probably want to comment out most of this file, especially
  835.     if you're not planning on using NFS (Network File System). You 
  836.     MUST leave the stanza to run inetd and syslogd uncommented. Note
  837.     that if you DON'T uncomment everything but inetd and syslogd, 
  838.     you may run into network problems at first. The best bet is to 
  839.     comment all of these things out, get yourself on the network, and
  840.     then worry about configuring the rest of the clients in rc.inet2.
  841.  
  842.     If you're not going to be using NFS, you can comment out the lines
  843.     to run: ugidd, mountd, nfsd, pcnfsd, and bwnfsd.
  844.  
  845.     You can comment out the stanza to run "umail" unless you have that 
  846.     package. In general, most of the things found in rc.inet2 are "sold 
  847.     separately". I recommend starting only inetd and syslog at first
  848.     until you get everything going.
  849.  
  850.     The following is a copy taken from Fred's net-032 distribution.
  851.     Please check the "NET" declaration, as some distributions might
  852.     keep the network daemons in another directory.
  853.  
  854.     Each of the stanzas basically says: "If the filename xxxxxx exists,
  855.     and it is an ordinary file (not a directory, pipe, etc.) then
  856.     execute the following commands".
  857.  
  858.  
  859. #! /bin/sh
  860. #
  861. # rc.inet2    This shell script boots up the entire INET system.
  862. #        Note, that when this script is used to also fire
  863. #        up any important remote NFS disks (like the /usr
  864. #        distribution), care must be taken to actually
  865. #        have all the needed binaries online _now_ ...
  866. #
  867. # Version:    @(#)/etc/rc.d/rc.inet2    2.18    05/27/93
  868. #
  869. # Author:    Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
  870. #
  871.  
  872. # Constants.
  873. NET="/usr/etc"
  874. IN_SERV="lpd"
  875. LPSPOOL="/var/spool/lpd"
  876.  
  877. # At this point, we are ready to talk to The World...
  878. echo -e "\nMounting remote file systems ..."
  879. /bin/mount -t nfs -v        # This may be our /usr runtime!!!
  880.  
  881. echo -e "\nStarting Network daemons ..."
  882. # Start the SYSLOG daemon.  This has to be the first server.
  883. # This is a MUST HAVE, so leave it in.
  884. echo -n "INET: "
  885. if [ -f ${NET}/syslogd ]
  886. then
  887.     echo -n "syslogd "
  888.     ${NET}/syslogd
  889. fi
  890.  
  891. # Start the SUN RPC Portmapper.
  892. if [ -f ${NET}/rpc.portmap ]
  893. then
  894.     echo -n "portmap "
  895.     ${NET}/rpc.portmap
  896. fi
  897.  
  898. # Start the INET SuperServer
  899. # This is a MUST HAVE, so leave it in.
  900. if [ -f ${NET}/inetd ]
  901. then
  902.     echo -n "inetd "
  903.     ${NET}/inetd
  904. else
  905.     echo "no INETD found.  INET cancelled!"
  906.     exit 1
  907. fi
  908.  
  909. # Start the NAMED/BIND name server.
  910. if [ ! -f ${NET}/named ]
  911. then
  912.     echo -n "named "
  913.     ${NET}/named
  914. fi
  915.  
  916. # Start the ROUTEd server.
  917. if [ -f ${NET}/routed ]
  918. then
  919.       echo -n "routed "
  920.       ${NET}/routed -q #-g -s
  921. fi
  922.  
  923. # Start the RWHO server.
  924. if [ -f ${NET}/rwhod ]
  925. then
  926.     echo -n "rwhod "
  927.     ${NET}/rwhod -t -s
  928. fi
  929.  
  930. # Start the U-MAIL SMTP server.
  931. if [ -f XXX/usr/lib/umail/umail ]
  932. then
  933.     echo -n "umail "
  934.     /usr/lib/umail/umail -d7 -bd </dev/null >/dev/null 2>&1 &
  935. fi
  936.  
  937. # Start the various INET servers.
  938. for server in ${IN_SERV}
  939. do
  940.     if [ -f ${NET}/${server} ]
  941.     then
  942.         echo -n "${server} "
  943.         ${NET}/${server}
  944.     fi
  945. done
  946.  
  947. # Start the various SUN RPC servers.
  948. if [ -f ${NET}/rpc.portmap ]
  949. then
  950.     if [ -f ${NET}/rpc.ugidd ]
  951.     then
  952.         echo -n "ugidd "
  953.         ${NET}/rpc.ugidd -d
  954.     fi
  955.     if [ -f ${NET}/rpc.mountd ]
  956.     then
  957.         echo -n "mountd "
  958.         ${NET}/rpc.mountd
  959.     fi
  960.     if [ -f ${NET}/rpc.nfsd ]
  961.     then
  962.         echo -n "nfsd "
  963.         ${NET}/rpc.nfsd
  964.     fi
  965.  
  966.     # Fire up the PC-NFS daemon(s).
  967.     if [ -f ${NET}/rpc.pcnfsd ]
  968.     then
  969.         echo -n "pcnfsd "
  970.         ${NET}/rpc.pcnfsd ${LPSPOOL}
  971.     fi
  972.     if [ -f ${NET}/rpc.bwnfsd ]
  973.     then
  974.         echo -n "bwnfsd "
  975.         ${NET}/rpc.bwnfsd ${LPSPOOL}
  976.     fi
  977.  
  978. fi
  979. echo network daemons started.
  980. # Done!
  981.  
  982. 4.2.2.1    "To named or not to named... that is the question."
  983.  
  984.     "I dub thee ... "
  985.     Named is the nameserver daemon that runs under TCP/IP. It allows
  986.     your machine to serve the name lookup requests of other machines...
  987.     that is, if a machine wants to find the IP address for 
  988.     "goober.norelco.com", and you have this machine's IP address in your
  989.     named database, then you can service the request and tell other
  990.     machines what goober's address is. 
  991.  
  992.     Under older implementations of Linux TCP/IP, to create aliases for
  993.     machine names (even for your own machine), you were required to run 
  994.     named on your Linux box to store name->IP address translations. The
  995.     problem with this is that named is generally difficult to setup and
  996.     maintain. To solve this problem, a program called "hostcvt.build"
  997.     was made available on Linux systems to translate your /etc/hosts file
  998.     (see section 4.3) into named database files. However, even with
  999.     this problem out of the way, running named on your system will cause
  1000.     some amount of CPU load and network traffic. 
  1001.  
  1002.     The bottom line is this: You DO NOT need to run named on your 
  1003.     Linux system. The SLS instructions will probably tell you to run
  1004.     hostcvt.build to set up named. This is simply unnecessary, UNLESS
  1005.     you want to make your Linux system a nameserver for some reason.
  1006.     Now, instead of putting hostnames into the named database, you can
  1007.     simply include them in the file /etc/hosts (section 4.3). When
  1008.     looking up names, your Linux system will first look in /etc/hosts
  1009.     and then ask the nameserver out on the net (if you have one).
  1010.  
  1011.     The only reason you may want to run named would be if:
  1012.       a) You're setting up a network of machines, and need a nameserver
  1013.          for one of them (and don't have a nameserver out on the net
  1014.          elsewhere);
  1015.       b) Your network admins want you to run your Linux system as a
  1016.          nameserver for some reason; or,
  1017.       c) You have a slow SLIP connection, and want to run a small
  1018.          cache-only nameserver on your Linux machine so that you don't
  1019.          have to go out on the phone line every time a name lookup
  1020.          occurs. (If you are only going to lookup a small number of
  1021.          machine names, and you know what they are, you can put their 
  1022.          addresses in /etc/hosts instead.) Generally name lookup isn't
  1023.          that slow, and should work fine over most SLIP connections.
  1024.       d) You want to run a nameserver for fun and excitement.
  1025.  
  1026.     In general, you DO NOT need to run named: this means that you
  1027.     can comment it out from rc.inet2, and you don't have to run
  1028.     hostcvt.build. If you want to alias machines, for example you want
  1029.     to refer to "loomer.vpizza.com" just as "loomer", you can add an
  1030.     alias in /etc/hosts instead. There is no reason to run named unless
  1031.     you truly want a full nameserver on your machine. If you already
  1032.     have a nameserver (most machines on the Internet do, and your net
  1033.     admins will tell you its address), don't bother running named.
  1034.  
  1035.     If you're only using loopback, you can run named and set your
  1036.     nameserver address to 127.0.0.1, but that's pointless. (No pun
  1037.     intended.) You don't need a nameserver at all if you use only
  1038.     loopback; the only hostname you know is your own, and it's in
  1039.     /etc/hosts (see section 4.3, below).
  1040.  
  1041.     Have I mentioned Olafs Network Administration Guide as described
  1042.     in section 0.3 (Related Documentation) yet ??
  1043.  
  1044. 4.3    /etc/hosts
  1045.  
  1046.     /etc/hosts contains a list of IP addresses and the hostnames they 
  1047.     map to. In this way, you can refer to other machines on the network
  1048.     by name, as well as by IP address. Using a nameserver (see section 4.1)
  1049.     also allows you to do the name->IP address translation automatically.
  1050.     (Running named allows you to run your own nameserver on your Linux
  1051.     box. See section 4.2.2.1 above.)
  1052.  
  1053.     This file needs to contain at least an entry for 127.0.0.1 with 
  1054.     the name "localhost". If you're not only using loopback, you need
  1055.     to contain an antry for your IP address, with your full hostname
  1056.     (such as loomer.vpizza.com).  You may also wish to include entries 
  1057.     for your gateway and network addresses. 
  1058.  
  1059.     For example, if "loomer.vpizza.com" has the IP address 
  1060.     "128.253.154.32", my /etc/hosts file would look like:
  1061.  
  1062.     # /etc/hosts: List of hostnames and IP addresses
  1063.     127.0.0.1         localhost
  1064.     128.253.154.32         loomer.vpizza.com loomer
  1065.     # end of hosts
  1066.  
  1067.     Once again, edit this for your own needs. If you're only using 
  1068.     loopback, the only line in /etc/hosts should be for 127.0.0.1, with
  1069.     both "localhost" and your hostname after it.
  1070.     
  1071.     Note that in the second line, above, there are two names for 
  1072.     128.253.154.32: "loomer.vpizza.com" and just "loomer". The first name 
  1073.     is the full hostname of the machine. The second is an alias---it 
  1074.     allows me to just use "rlogin loomer" without having to type in the 
  1075.     entire name.
  1076.  
  1077. 4.3.1    Important note regarding /etc/hosts from NET-032.
  1078.  
  1079.     If you using the hosts file that came with NET-032, then:
  1080.     The line "%%IP%%    %%HOST%% %%ALIAS%%" needs to be deleted from 
  1081.     this file! This is a "tag" line used by Fred's experimental net
  1082.     config scripts. Matt Welsh is now writing a new set of scripts which
  1083.     don't use these lines. In any of these files, you see curious lines
  1084.     with entries such as "%%NAME%%", these lines MUST be deleted. If you
  1085.     don't delete them, you may have lots of strange errors and overflowing
  1086.     syslog files.
  1087.  
  1088. 4.4    /etc/networks
  1089.  
  1090.     The /etc/networks file lists the names and addresses of your own,
  1091.     and other, networks. It is used by the route command, and allows
  1092.     you to specify a network by name, should you so desire.
  1093.  
  1094.     NOTE: Every network you wish to add a route to using the 'route'
  1095.     command MUST have an entry in /etc/networks
  1096.  
  1097.     Its format is similar to that of the /etc/hosts file, (Sec 4.3)
  1098.     and an example one might look like:
  1099.  
  1100. #
  1101. # /etc/networks: list all networks that you wish to add route commands
  1102. #                for in here
  1103. #
  1104. default        0.0.0.0        # default route    - mandatory
  1105. loopnet        127.0.0.0    # loopback network - mandatory
  1106. mynet        128.253.154.0    # Example network CHANGE to YOURS
  1107. #
  1108. # end of networks
  1109.  
  1110.     
  1111. 4.5    /etc/host.conf
  1112.  
  1113.     The system has some library functions called the resolver library.
  1114.     This file specifies how your system will lookup host names. It should
  1115.     contain the two lines:
  1116.  
  1117.         order hosts,bind
  1118.         multi on
  1119.  
  1120.     These two lines tell the resolve libraries to first check the 
  1121.     /etc/hosts file for any names to lookup, and then ask the nameserver
  1122.     (if one is present). The "multi" entry allows you to have multiple
  1123.     IP addresses for a given machine name in /etc/hosts.
  1124.  
  1125.     This file comes from the implementation of the resolv+ bind 
  1126.     library for Linux. You can find further documentation in the
  1127.     resolv+(8) man page (if you have the man page available).
  1128.  
  1129.     If you don't, they are available from:
  1130.         Site:           src.doc.ic.ac.uk [146.169.2.1]
  1131.         Directory:      /computing/comms/tcpip/nameserver/resolv+
  1132.         File:           resolv+2.1.1.tar.Z
  1133.  
  1134.     This file contains resolv+.8, which is the man page for the
  1135.     resolver library.
  1136.  
  1137. 4.6    /etc/resolv.conf
  1138.  
  1139.     This file actually configures the system name resolver.
  1140.     This file contains two types of entries: The addresses of your
  1141.     nameservers (if any), and the name of your domain (if you have one).
  1142.     If you're running your own nameserver (i.e., you're running named
  1143.     on your Linux machine: see section 4.2.2.1), then the address of
  1144.     your nameserver is just 127.0.0.1 (the loopback address).
  1145.  
  1146.     Your domain name is your fully-qualified hostname (if you're a
  1147.     registered machine on the Internet, for example), with the hostname
  1148.     chopped off. That is, if your full hostname is loomer.vpizza.com,
  1149.     your domain name is just "vpizza.com", without the hostname ("loomer").
  1150.  
  1151.     For example, if your machine is goober.norelco.com, and has a
  1152.     nameserver at the address 128.253.154.5, your /etc/resolv.conf would 
  1153.     look like:
  1154.  
  1155.         domain norelco.com
  1156.         nameserver 127.253.154.5
  1157.  
  1158.     You can specify more than one nameserver. Each one
  1159.     must have a "nameserver" line of its own in resolv.conf.
  1160.  
  1161.     If you're only using loopback, you don't need a nameserver.
  1162.  
  1163. 4.7    /etc/HOSTNAME
  1164.  
  1165.     This is a new file; it contains the full hostname of your machine 
  1166.     (with the domain name). It is used by the 'hostname' command, to
  1167.     saveyou having to supply the hostname as an argument. For example,
  1168.     the machine above would have the file /etc/HOSTNAME:
  1169.  
  1170.         goober.norelco.com
  1171.  
  1172.     That's all.
  1173.  
  1174. 4.8    /etc/rc.local
  1175.  
  1176.     Change the line in /etc/rc.local (or /etc/rc, depending on your
  1177.     setup) which sets your system's hostname, to
  1178.  
  1179.         /bin/hostname -S
  1180.  
  1181.     (You have a new hostname in /bin.) This sets your hostname from
  1182.     the name found in /etc/HOSTNAME. If you don't like this (personally
  1183.     I don't), just do:
  1184.         /bin/hostname -S <your-hostname>
  1185.  
  1186.     For example,
  1187.         /bin/hostname -S loomer.vpizza.com
  1188.  
  1189.     It IS important that you give a full hostname (with domain name)
  1190.     in /etc/HOSTNAME. This allows the hostname command to set the
  1191.     host AND domainname in one shot. 
  1192.  
  1193.     IMPORTANT: The hostname found in /etc/HOSTNAME *must* be a valid
  1194.     hostname. This means that it must be found in /etc/hosts (or that
  1195.     your nameserver must be able to resolve it, but you should put it
  1196.     in /etc/hosts in case your nameserver is down).
  1197.  
  1198. 4.9    Other files.
  1199.  
  1200.     There are of course many other files in /etc which you may need to
  1201.     dabble with later on. Instead of going into them here, I'm going to
  1202.     provide the bare minimum to get you on the net. More information will
  1203.     be provided in later versions of the NET-2 HOWTO.
  1204.  
  1205.     Once you have all of the files set up, and everything in the 
  1206.     right place, you should be able to reboot your new kernel and
  1207.     net away to your heart's content. However, I strongly suggest
  1208.     that you keep a bootable copy of your old kernel and even possibly
  1209.     a "recovery disk" (say, the SLS a1 disk, or HJLu's single disk
  1210.     boot disk) in case you hosed your /etc/rc files, for example,
  1211.     and can't login when you boot. 
  1212.  
  1213.  
  1214. 5.    Configuring SLIP.
  1215.  
  1216.     SLIP (Serial Line Internet Protocol) allows you to use TCP/IP 
  1217.     over a serial line, be that a phone line, with a dialup modem, or
  1218.     a leased asynchronous line of some sort. Of course, to use SLIP you'll
  1219.     need access to a dial-in SLIP server in your area. Many universities
  1220.     and businesses provide SLIP access all over the world.
  1221.  
  1222.     SLIP uses the serial ports on your machine to carry IP datagrams.
  1223.     To do this is must take control of the serial device. Slip devices
  1224.     are named 'sl0', 'sl1' etc, how do these correspond to your serial
  1225.     devices ? The networking code uses what is called an IOCTL (I/O
  1226.     control) call to change the serial devices into slip devices. There
  1227.     are two programs supplied that can do this, they are 'dip' and
  1228.     'slattach'.
  1229.  
  1230.     'dip' (Dialup IP) is a smart program that is able to set the speed
  1231.     of the serial device, command your modem to dial the remote end of
  1232.     the link, automatically log you into the remote machine, search for
  1233.     messages sent to you and extract information from them such as your
  1234.     IP address, and perform the IOCTL to change the serial device over
  1235.     to a slip device.
  1236.  
  1237.     'slattach' on the other hand does very little other than set the
  1238.     serial device speed and perform the IOCTL to convert it to a slip
  1239.     device.
  1240.  
  1241.     When do you use which ? You would use dip when your link to the
  1242.     machine that is your slip server is a dialup modem, or some other
  1243.     temporary link. You would use 'slattach' when you have a leased
  1244.     line, perhaps a cable, between two machines, and there is no special
  1245.     action needed to get the link working. See section 5.4 for more
  1246.     information.
  1247.     
  1248.     Configuring SLIP is much like configuring an Ethernet interface
  1249.     (please read section 4.0 above). However, there are a few key
  1250.     differences.
  1251.  
  1252.     First of all, slip links are unlike an Ethernet network in that
  1253.     there are only ever two hosts on the network, one at each end.
  1254.     Unlike an ethernet that is available for use as soon as you are
  1255.     cabled, with slip, depending on the type of link you have, you
  1256.     may have to command your modem to establish the connection to
  1257.     the remote modem. Dialing in and connecting to your SLIP server is 
  1258.     usually done at boot time, usually by a program called "dip" 
  1259.     (found in the "dip" subdir of the net-032 package). "Dip" not only 
  1260.     dials and logs you into the SLIP server, but it also initiates the 
  1261.     SLIP connection and runs the appropriate ifconfig and route commands 
  1262.     to initialize the device. Therefore, the only lines needed in 
  1263.     /etc/rc.d/rc.inet1 are the few commands to initilize the loopback 
  1264.     connection at the top (see section 4.2.1 above).
  1265.  
  1266.     If you're not using DIP, you may indeed have to edit rc.inet1 for
  1267.     your SLIP parameters.
  1268.  
  1269.     Also, there are two types of SLIP servers: Dynamic IP address
  1270.     servers and static IP address servers. Dynamic servers allocate
  1271.     a new, different IP address to you every time you dialin and
  1272.     initiate a connection. Static servers give you the same address
  1273.     every time. Almost every SLIP server will also prompt you for
  1274.     a username and password when dialing in: DIP can handle logging
  1275.     you in automatically.
  1276.  
  1277.     Essentially, configuring a SLIP connection is just like configuring
  1278.     for loopback or ethernet. The main differences are discussed below.
  1279.     Read section 4.0 above for information on configuring your TCP/IP
  1280.     files, and apply the changes below.
  1281.  
  1282. 5.1    Static SLIP server connections using a dialup line.
  1283.  
  1284.     If you have a static-allocation server (same IP address every time),
  1285.     then you may want to put entries for your hostname and IP address
  1286.     (since you know what your IP address is!) in /etc/hosts. You should
  1287.     also configure the other files listed in section 4.0: rc.inet2, 
  1288.     host.conf, resolv.conf, /etc/HOSTNAME, and rc.local). Remember that
  1289.     when configuring rc.inet1, you don't need to run the ifconfig and
  1290.     route commands other than the two for the loopback interface (if
  1291.     you're using DIP to dial your connection).
  1292.  
  1293.     In general, your gateway is the IP address of your SLIP server.
  1294.     Because DIP handles the configuration of the route, you probably
  1295.     don't need to know this, but in some cases you might have to run the
  1296.     appropriate ifconfig or route commands in /etc/rc.d/rc.inet1 to
  1297.     get it to work correctly. Instead of using "eth0" as your interface 
  1298.     name, SLIP connections use "sl0".  Keep in mind that you can't
  1299.     ifconfig sl0 until you have dialed the connection and connected to
  1300.     the SLIP server.
  1301.  
  1302.     Also, you may need to use the "pointopoint" argument to ifconfig if
  1303.     DIP does not do it correctly. For example, if your SLIP server's 
  1304.     address is 44.136.8.5, and your IP address is 128.253.154.32, you may 
  1305.     need to run the command 
  1306.  
  1307.         # /etc/ifconfig sl0 128.253.154.32 pointopoint 44.136.8.5
  1308.  
  1309.     See the man pages for ifconfig in the net-032 package.
  1310.  
  1311. 5.2    Static SLIP server connections using a leased line or cable.
  1312.  
  1313.     If you have a leased line, or cable to your slip server, then you
  1314.     do not need to worry with the hassle of causing your modem to
  1315.     dial and establish the connection. In this situation the 'slattach'
  1316.     program is the best solution for configuring your SLIP link.
  1317.  
  1318.     I can think of no better way of describing the process than by
  1319.     illustration. In your rc.inet1 file you would have something similar
  1320.     to the following:
  1321.  
  1322. # Portion of /etc/rc.d/rc.inet1 for leased line static slip connection
  1323. #!/bin/sh
  1324. IPADDR="128.253.154.32"         # REPLACE with YOUR IP address!
  1325. REMADDR="128.253.154.33"    # REPLACE with YOUR OTHER SLIP servers address!
  1326.  
  1327. slattach -p cslip -s 19200 /dev/ttyS0
  1328. /etc/ifconfig sl0 $IPADDR pointopoint $REMADDR up
  1329. /etc/route add default gw $REMADDR
  1330.  
  1331. # End
  1332.  
  1333.     slattach allocates the first unallocated slip device to the serial
  1334.     device specified. slattach starts with 'sl0'. Therefore the first
  1335.     slattach command attaches slip device 'sl0' to the serial device
  1336.     specified, 'sl1' the next time etc.
  1337.  
  1338.     Note also that the first parameter that slattach accepts is one to
  1339.     specify the protocol. At present the only working values are
  1340.     'slip', and 'cslip'. 'cslip' is compressed slip, it is the same
  1341.     slip, except that the datagrams headers have been compressed to
  1342.     reduce overhead on the link. On good clean links this is recommended.
  1343.     In future protocols such as PPP, and KISS (for Amateur Radio use)
  1344.     will be offered.
  1345.  
  1346.     After you have 'slattached' the interface, you can now configure
  1347.     it with ifconfig as you would an ethernet interface, but since
  1348.     there is only one other machine that you can talk to directly via
  1349.     the link you do not need to worry about netmasks and the like.
  1350.     Normally you would point your default route to the slip interface,
  1351.     as it is your connection to every other machine. The pointopoint
  1352.     parameter should automatically add a route to the machine at the
  1353.     other end of the link. Its primary function is to tell your machine
  1354.     that there are no other hosts on that network interface.
  1355.  
  1356.     If you have more than one slip interface then you will have routing
  1357.     considerations to make. You will have to decide what routes to
  1358.     add, and those decisions can only be made on the basis of the
  1359.     actual layout of your network connections.
  1360.  
  1361. 5.3    Dynamic SLIP server connections using a dialup line.
  1362.  
  1363.     If your SLIP server allocates a new IP address to you every time
  1364.     you dialin, you don't know your IP address at all, so you can't
  1365.     include an entry in /etc/hosts for your machine. (If you want, you 
  1366.     can place your hostname in /etc/hosts with the address 127.0.0.1). 
  1367.  
  1368.     Most dynamic SLIP servers tell you your IP address when you initiate 
  1369.     the connection. For example, it may print a string such as, "Your IP 
  1370.     address is 128.253.154.10. Server address is 128.253.154.1." DIP will 
  1371.     need to know these numbers when it configures the connection. See 
  1372.     section 5.3 below on using DIP.
  1373.  
  1374.     If you use DIP, it does all of the work of configuring the 
  1375.     connection when you dialin, so rc.inet1 only needs the two lines
  1376.     to configure the loopback address (see section 4.2.1 above). 
  1377.     Also, see section 5.1 above. You need to configure all of
  1378.     the files listed in section 4.0. Your gateway address (should you
  1379.     need to know it) will be the address of the SLIP server. Also,
  1380.     you may need to run ifconfig on sl0 using the SLIP server's address
  1381.     as the "pointopoint" argument (see section 5.1 above). However, if 
  1382.     you use DIP, it should be able to do all of the ifconfig and route 
  1383.     commands for you.
  1384.  
  1385.     One good way to figure out how to configure SLIP on your machine is
  1386.     to find someone else who uses the SLIP server (it can be on a PC,
  1387.     Mac, UNIX box, whatever) and find out what numbers they use. 
  1388.  
  1389.  
  1390. 5.4    Using DIP.
  1391.  
  1392.     DIP can simplify the process of dialing into the SLIP server, logging
  1393.     in, starting the connection, and configuring the sl0 device with
  1394.     the appropriate ifconfig and route commands. 
  1395.  
  1396.     Essentially, to use DIP you'll write a "chat script" which is 
  1397.     basically a list of commands to send to DIP along with commands for
  1398.     logging in, starting the connection, and so on. See "sample.dip"
  1399.     in the net-032 package for an explanation. DIP is quite a powerful
  1400.     program, with many options. Instead of going into all of them here
  1401.     you should look at the READMEs and the sample files from tsx-11 and
  1402.     the net-032 distribution.
  1403.  
  1404.     You may notice that the sample.dip script assumes that you're using
  1405.     a static SLIP server, so you know what your IP address is beforehand.
  1406.     For dynamic SLIP servers, the newer version of dip include a command
  1407.     you can use to automatically read and configure your interface
  1408.     with the address printed by your server. The following sample was
  1409.     contributed by Paul Mossip, and is probably a good starting point
  1410.     for you:
  1411.  
  1412.  
  1413. #
  1414. # Connection script for SLIP to knoware.nl.mugnet.org
  1415. #
  1416.  
  1417.   # Fetch the IP address of our target host.
  1418. main:
  1419.  
  1420.   # Set the desired serial port and speed.
  1421.   port /dev/cua0
  1422.   speed 38400
  1423.  
  1424.   # Reset the modem and terminal line.
  1425.   reset
  1426.  
  1427.   # Prepare for dialing.
  1428.   send ATZ1\r
  1429.   wait OK 4
  1430.   if $errlvl != 0 goto error
  1431.   dial 666-0999                ## Change to your servers number!
  1432.   if $errlvl != 0 goto error
  1433.   wait CONNECT 60
  1434.   if $errlvl != 0 goto error
  1435.  
  1436.   # We are connected.  Login to the system.
  1437. login:
  1438.   sleep 3
  1439.   send \r\n\r\n
  1440.   wait gracelands> 20            ## Change to your servers prompt
  1441.   if $errlvl != 0 goto error
  1442.   send login\n
  1443.   wait name: 10                ## Wait username: prompt
  1444.   if $errlvl != 0 goto erro
  1445.   send elvisp\n                ## Change to your own!
  1446.   wait ord: 10                ## Wait password prompt
  1447.   if $errlvl != 0 goto error
  1448.   send alive\n                ## Change to your own!
  1449.   wait gracelands> 10
  1450.   if $errlvl != 0 goto error
  1451.   send slip\n                ## Change to suit your server
  1452.   wait SLIP 30                ### Wait for SLIP prompt
  1453.   if $errlvl != 0 goto error
  1454.   get $local remote 10            ## Assumes the server sends your IP..
  1455.   if $errlvl != 0 goto error        ## address as soon as you enter slip.
  1456.   get $remote gracelands        ## slip server address from /etc/hosts
  1457. done:
  1458.   print CONNECTED to $remote with address $rmtip we are $local
  1459.   default
  1460.   mode SLIP
  1461.   goto exit
  1462. error:
  1463.   print SLIP to $host failed.
  1464. exit:
  1465. #
  1466. # End dip script
  1467.  
  1468.  
  1469.     The example above will automatically point your default route via your
  1470.     slip link, if this is not what you want, you might have an ethernet
  1471.     connection that should be your default route, then remove the 'default'
  1472.     command.
  1473.  
  1474.     The above example is fairly robust. Please refer to the 'dip' man
  1475.     page for more information.
  1476.  
  1477.     It should be simple to modify the code for DIP in the file attach.c
  1478.     to run the route and ifconfig commands that work for you automatically.
  1479.  
  1480. 5.5    Configuring your Linux Machine as a SLIP Server.
  1481.  
  1482.     Note: Some of the information below came from the dip man pages,
  1483.     where in fact how to run Linux as a slip server is briefly documented.
  1484.  
  1485.     To configure Linux as a slip server, you need to create Special
  1486.     slip accounts for users, where dip (in slave mode) is used as the
  1487.     login shell. Fred suggests that he has a convention of having all
  1488.     of his Slip accounts begin with a capital 'S', eg "Sfredm".
  1489.  
  1490.     Because the login program won't accept arguments to the login shell,
  1491.     you will need to create a small program that looks like the following:
  1492.  
  1493. /* dip-i.c - from a mail message of Karl kkeyte@esoc.bitnet */
  1494. int main()
  1495. {
  1496.    execlp("dip", "dip", "-i", (char *) 0);
  1497. }
  1498.  
  1499.     Compile it with: 'gcc -O dip-i.c -o dip-i'
  1500.  
  1501.     Give it permissions 555. I recommend calling it /usr/bin/dip-i as
  1502.     shown below.
  1503.  
  1504.     A sample /etc/passwd entry for a Slip user looks like:
  1505.  
  1506.     Sfredm:ij/SMxiTlGVCo:1004:10:UUNET:/tmp:/usr/bin/dip-i
  1507.      ^^         ^^        ^^  ^^   ^^    ^^   ^^
  1508.       |          |         |   |    |     |    \__ shell program running
  1509.           |          |         |   |    |     |         dip -i as login shell
  1510.       |          |         |   |    |     \_______ Home directory
  1511.       |          |         |   |    \_____________ User Full Name
  1512.       |          |         |   \__________________ User Group ID
  1513.       |          |         \______________________ User ID
  1514.       |          \________________________________ Encrypted User Password
  1515.       \___________________________________________ Slip User Login Name
  1516.  
  1517. ---End of part 1/2---
  1518.  
  1519.  
  1520.